/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webservicespike;

import javax.xml.ws.Endpoint;

/**
 *
 * @author Renato Rosa <2101076@my.ipleiria.pt>
 */
public class HelloService implements Runnable {
    
    private String wsAddress = "http://localhost:8080/HelloWS/HelloFunctions";
    private Hello methods;

    public HelloService(Hello methods) {
        this.methods = methods;
    }
    
    @Override
    public void run() {
        Endpoint.publish(wsAddress, methods);
        System.out.println("Web service was published successfully.\n" + "WSDL URL: " + wsAddress + "?WSDL");
        // Keep the local web server running until the process is killed
        while (Thread.currentThread().isAlive()) {
            try {
                Thread.sleep(10000);
            } catch (InterruptedException ex) {
            }
        }
    }
    
}
